<!DOCTYPE html>
<html>
<head>
	<title>原型继承</title>
</head>
<body>
<script type="text/javascript">

/* 
	1. 原型继承只能继承原型上的属性和方法
	2. 原型的继承不能直接使用原型，应该使用实例对象，否则子类会改变父类的实例方法。
*/
	
function Person(name) {
	this.name = name;
}
Person.prototype.say = function() {
	console.log(this.name);
}

function Student(name) {
	this.name = name;
}
Student.prototype = Person.prototype;
Student.prototype = new Person(name);
Student.prototype.constructor = Student;


let student = new Student('name');
student.say();

</script>
</body>
</html>
